// Copyright Dotware Technologies 2005. Author Hadi Asghari.

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace dwDbfViewer
{
	/// <summary>
	/// Summary description for FormOptions.
	/// </summary>
	public class FormOptions : System.Windows.Forms.Form
	{
		private System.Windows.Forms.Button btnClose;
		private System.Windows.Forms.Label label1;
		private System.Windows.Forms.NumericUpDown numMaxRecords;
		/// <summary>
		/// Required designer variable.
		/// </summary>
		private System.ComponentModel.Container components = null;

		public FormOptions()
		{
			//
			// Required for Windows Form Designer support
			//
			InitializeComponent();

			//
			// TODO: Add any constructor code after InitializeComponent call
			//
		}

		/// <summary>
		/// Clean up any resources being used.
		/// </summary>
		protected override void Dispose( bool disposing )
		{
			if( disposing )
			{
				if(components != null)
				{
					components.Dispose();
				}
			}
			base.Dispose( disposing );
		}

		#region Windows Form Designer generated code
		/// <summary>
		/// Required method for Designer support - do not modify
		/// the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
			this.btnClose = new System.Windows.Forms.Button();
			this.label1 = new System.Windows.Forms.Label();
			this.numMaxRecords = new System.Windows.Forms.NumericUpDown();
			((System.ComponentModel.ISupportInitialize)(this.numMaxRecords)).BeginInit();
			this.SuspendLayout();
			// 
			// btnClose
			// 
			this.btnClose.Location = new System.Drawing.Point(131, 125);
			this.btnClose.Name = "btnClose";
			this.btnClose.TabIndex = 0;
			this.btnClose.Text = "Close";
			this.btnClose.Click += new System.EventHandler(this.btnClose_Click);
			// 
			// label1
			// 
			this.label1.Location = new System.Drawing.Point(8, 32);
			this.label1.Name = "label1";
			this.label1.Size = new System.Drawing.Size(192, 23);
			this.label1.TabIndex = 2;
			this.label1.Text = "Maximum number of records to read:";
			// 
			// numMaxRecords
			// 
			this.numMaxRecords.Increment = new System.Decimal(new int[] {
																			1000,
																			0,
																			0,
																			0});
			this.numMaxRecords.Location = new System.Drawing.Point(216, 32);
			this.numMaxRecords.Maximum = new System.Decimal(new int[] {
																		  10000000,
																		  0,
																		  0,
																		  0});
			this.numMaxRecords.Name = "numMaxRecords";
			this.numMaxRecords.Size = new System.Drawing.Size(104, 20);
			this.numMaxRecords.TabIndex = 3;
			this.numMaxRecords.TextAlign = System.Windows.Forms.HorizontalAlignment.Right;
			this.numMaxRecords.ThousandsSeparator = true;
			this.numMaxRecords.Value = new System.Decimal(new int[] {
																		1000,
																		0,
																		0,
																		0});
			// 
			// FormOptions
			// 
			this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
			this.ClientSize = new System.Drawing.Size(336, 173);
			this.ControlBox = false;
			this.Controls.Add(this.numMaxRecords);
			this.Controls.Add(this.label1);
			this.Controls.Add(this.btnClose);
			this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
			this.Name = "FormOptions";
			this.Text = "Options";
			this.Load += new System.EventHandler(this.FormOptions_Load);
			((System.ComponentModel.ISupportInitialize)(this.numMaxRecords)).EndInit();
			this.ResumeLayout(false);

		}
		#endregion

		private void btnClose_Click(object sender, System.EventArgs e)
		{
			Singleton.Instance().MaxRecords = (int) numMaxRecords.Value;
			this.Close();
		}

		private void FormOptions_Load(object sender, System.EventArgs e)
		{
			numMaxRecords.Value = Singleton.Instance().MaxRecords;
		}
	}
}
